package com.example.chapter3.Dao;

import com.example.chapter3.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
@Mapper
public interface UserDao {
    @Select("select count(1) from user where username = #{name}")
    int findUserByName(String name);
    @Insert("insert into user(username,password,sex) values (#{username},#{password},#{sex})")
    int creatUser(User user);
    @Select("select * from user where username = #{name}")
    User findUserByNameForLogin(String name); // 添加这个方法
}